{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# AIRCAS HOPITAL 项目所遇到的问题和解决方法"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. 搭建前端VUE框架时网速感人\n",
    "由于代码源在国外，又不能用工作电脑翻墙，只用考虑用国内的镜像，NPM还挺方便的，可以直接修改源。通过百度网盘下了nodejs（nodejs在windows下竟然可以自己加入环境变量好评！）并安装，打开cmd， 输入命令： \n",
    "```\n",
    "    npm install -g cnpm --registry=https://registry.npm.taobao.org\n",
    "    cnpm install cnpm -g # update cnpm\n",
    "```\n",
    "\n",
    "安装VUE，以及VUE-CLI（可选）：\n",
    "```\n",
    "    cnpm install vue\n",
    "    cnpm install --global vue-cli\n",
    "```\n",
    "\n",
    "新建VUE项目目录并CD进入：\n",
    "```\n",
    "    vue init webpack \"项目名称\"\n",
    "    cnpm install\n",
    "    cnpm run dev\n",
    "```\n",
    "\n",
    "如果需要使用Element-ui, 还需要下载此组件：\n",
    "```\n",
    "    cd project_path\n",
    "    cnpm i element-ui -S \n",
    "```\n",
    "\n",
    "在Vue项目的main.js中加入：    \n",
    "```javascript\n",
    "import ElementUI from 'element-ui'\n",
    "Vue.use(ElementUI)\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. SpringBoot JPA Mapped failed\n",
    "两三年没用springboot的项目了，代码还在GITHUB上，但是比较大，懒得看了。在用Hibernate做数据库的映射时候卡住了，由于一张关系表内使用了两个外键，大概是注解不对，一直出现映射失败的错误。    \n",
    "表的情况如下： \n",
    "1. 记录了实时设备信息的表\n",
    "2. 护士职工表\n",
    "3. 记录护士负责设备的关系表   \n",
    "第三张表有1和2的外键，在映射关系上， 第三张表中的设备和1表应该是一对一的关系（可能也是一对多？）， 第三张表中护士和2表中的护士是多对一的关系，因为每个护士可能会负责多个设备。 在代码上应该是3表为主动，维护1和2的关系，所以映射注解应该写在3表的DAO类里，我之前老想反了。  \n",
    "\n",
    "```java\n",
    "@OneToOne(cascade = CascadeType.MERGE)\n",
    "@JoinColumn(name = \"id_device\")\n",
    "private DeviceDAO id_device;\n",
    "\n",
    "@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.REFRESH}, optional=false}\n",
    "@JoinColumn(name = \"id_user\")\n",
    "private UserDAO id_user;\n",
    "\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
